package com.jiayang.hhotel.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.jiayang.hhotel.R;

/**
 * Created by Administrator on 2017/5/27 0024.
 * 级别适配器(新增合同时间页面的选择级别对话框)
 */

public class LevelAdapter extends BaseAdapter{

    private Context t;
    private String[] mList;
    public LevelAdapter(Context context, String[] list ){
        this.t=context;
        this.mList=list;
    }

    @Override
    public int getCount() {
        return mList.length;
    }

    @Override
    public Object getItem(int position) {
        return mList[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    ViewHolder holder;
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView==null){
            convertView= LayoutInflater.from(t).inflate(R.layout.single_line_text_item,null);
            holder=new ViewHolder(convertView);
            convertView.setTag(holder);
        }
        holder= (ViewHolder) convertView.getTag();
        holder.tv.setText(mList[position]);
        return convertView;
    }

    public class ViewHolder{
        TextView tv;

        public ViewHolder(View view){
            tv= (TextView) view.findViewById(R.id.tv_tv);
        }
    }

}
